{yun:}include file="$comstyle/header.htm"{/yun} 
<script src="{yun:}$config.sy_weburl{/yun}/js/lssave.js?v={yun:}$config.cachecode{/yun}" type="text/javascript"></script> 
<script src="{yun:}$config.sy_weburl{/yun}/js/binding.js?v={yun:}$config.cachecode{/yun}"></script> 
<script src="{yun:}$config.mapurl{/yun}"></script>
<script type="text/javascript" src="{yun:}$config.sy_weburl{/yun}/js/map.js?v={yun:}$config.cachecode{/yun}"></script>

<script language="javascript">
	
function CheckPost(){ 
	var title=$.trim($("input[name='title']").val());
	if(title==''){
		layer.msg('产品标题不能为空！', 2, 8);return false;
	}
	if(title.lentgh>30){
		layer.msg('请将标题控制在30字以内！', 2, 8);return false;
	}
	if($.trim($("input[name='pic']").val())=='' && $.trim($("input[name='id']").val())==''){
		layer.msg('产品图片不能为空！', 2, 8);return false;
	}
	$("#productform").submit();
	layer.load('执行中，请稍候...',0);
} 
</script> 

<div class="w1000">
	<div class="admin_mainbody"> 
	{yun:}include file="$comstyle/left.htm"{/yun} 
    <div class=right_box>
		<div class=admincont_box>

        <iframe id="supportiframe"  name="supportiframe" onload="returnmessage('supportiframe');" style="display:none"></iframe>
        <form id="productform" name="myform" method="post" target="supportiframe" action="index.php?c=product&act=save" autocomplete="off" enctype="multipart/form-data" class="layui-form">
			<div class="com_tit"><span class="com_tit_span">添加产品</span></div>
			<div class="job_list_tit">
				<ul class="">
					<li><a href="index.php?c=info">基本信息</a></li>
					<li><a href="index.php?c=map">企业地图</a></li>
					<li><a href="index.php?c=news">企业新闻</a></li>
					<li><a href="index.php?c=show">企业环境</a></li>
					<li class="job_list_tit_cur"><a href="index.php?c=product">企业产品</a></li>
					<li><a href="index.php?c=companyaddress">企业地址</a></li>
				</ul>
			</div>

			<div class="clear"></div>
			
           <div class="com_release_box">
			<ul>
				<li>
					<div class="com_release_name"><i class="ff0">*</i> 产品标题</div>
					<input type="text"  name="title" value="{yun:}$editrow.title{/yun}"class="com_info_text" style="width:200px;"  >
					<span id="by_name"  class="errordisplay">不能为空</span>
				</li>
				<li>
					<div class="com_release_name"><i class="ff0">*</i> 产品图片</div>
					<div class="add_product_text">
						<button type="button" class="yun_bth_pic adminupload" lay-data="{name: 'pic',imgid: 'imgicon',parentid: 'imgparent'}">上传图片</button> 
						最佳尺寸：宽/高=270像素/180像素<span id="by_name" class="errordisplay">不能为空</span>
						<input type="hidden" id="layupload_type" value="2"/>
						<input type="hidden" id="upload_path" value="product"/>
						<input type="hidden" name="pic" value="{yun:}$editrow.pic{/yun}"/>
					</div>
				</li>
				<li id="imgparent" {yun:}if !$editrow.pic{/yun}class="none"{yun:}/if{/yun}>
					<div class="com_release_name"><i class="ff0">*</i> 图片展示</div>
					<img id="imgicon" src="{yun:}$config.sy_weburl{/yun}/{yun:}$editrow.pic{/yun}" width="100" height="60"/>
				</li>
				<li class="jobadd_list_fl">
					<div class="com_release_name">产品标签</div>
 					<div class="layui-form-item">
						<div class="layui-input-block">
							<span class="" id="addwelfarelist">
								{yun:}foreach from=$editrow.arraywelfare key=key item=tv{/yun}
									<input name="welfare[]" id="welfare{yun:}$tv{/yun}" value="{yun:}$tv{/yun}" {yun:}if in_array($tv,$editrow.arraywelfare){/yun} checked="checked" {yun:}/if{/yun} type="checkbox" title="{yun:}$tv{/yun}" data-tag="{yun:}$tv{/yun}" class="changewelfare" lay-skin="primary">
								{yun:}/foreach{/yun}
							</span>

							<div class="addwelfare_b">
								<input class="addwelfare_text" type="text" tabindex="1000" id="addwelfare" ><a class="addwelfarebox">添加标签</a>    
							</div>
						</div>
					</div>
				</li>
				<li>
					<input type="hidden" id="logid" name="id" value="{yun:}$editrow.id{/yun}">
					<input class="btn_01" style="_margin-left:-3px" type="button" onclick="CheckPost()" value="保存信息">
					<input id="save" name="save" value="{yun:}$row.linkman{/yun}" type="hidden"/>
				</li>
            </ul>
            <div class="clear"></div>
          </div>
          
		  <div class="clear"></div>
        </form>
		<div class="clear"></div>
      </div>
    </div>
  </div>
</div>  
<div class="clear"></div>


 <script>
$(function () {
	
	$('.addwelfarebox').click(function(){

		var welfare = $('#addwelfare').val();
		var error=0;
		if(welfare.length>=2 && welfare.length<=8){
			
			$('.changewelfare').each(function(){
				var otag = $(this).attr('data-tag');
				if(welfare == otag){
					layer.msg('相同标签已存在，请选择或重新填写！', 2,8);
					error = 1;
				}
			});
			if(error==0){
				$('#addwelfarelist').append('<input name="welfare[]" value="'+welfare+'" checked="checked"  type="checkbox" title="'+welfare+'" data-tag="'+welfare+'" class="changewelfare" lay-skin="primary">');
				layui.use(['layer', 'form'], function(){
				    var layer = layui.layer
				    ,form = layui.form
				    ,$ = layui.$;
				    form.render('checkbox');
				});
			}
			$('#addwelfare').val('');
		}else{
			layer.msg('请输入2-8个标签字符！', 2,8);
		}
		
	});
});




</script>
<script language=javascript src='{yun:}$config.sy_weburl{/yun}/data/plus/city.cache.js?v={yun:}$config.cachecode{/yun}'></script>
<script language=javascript src='{yun:}$config.sy_weburl{/yun}/js/city.js?v={yun:}$config.cachecode{/yun}'></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui.upload.js?v={yun:}$config.cachecode{/yun}" type='text/javascript'></script> 

<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.config.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.all.min.js?v={yun:}$config.cachecode{/yun}"></script>

{yun:}include file="$comstyle/footer.htm"{/yun}